import {render, Component, createElement} from './toy-react.js'
// window.a = <div id="app" class="head"></div>

class Hello extends Component {
    constructor () {
        super()
        this.state = {
            count: 0,
            name: 'Jack'
        }
    }
    render () {
        return <div>
            <button onClick={() => {this.setState({count: this.state.count+1})} }>add</button>
            <p>count:{this.state.count.toString()}</p>
            <p>name:{this.state.name}</p>
            {this.children}
        </div>
    } 
}


window.a = <Hello id="app" class="head">
    <span>1</span>
    <span>2</span>
    <span><h1>3</h1><h1>4</h1></span>
    hello
</Hello>

render(window.a, document.body)
